/**
 * Created by IntelliJ IDEA.
 * User: Bezdelnick
 * Date: 10.05.13
 * Time: 16:51
 * To change this template use File | Settings | File Templates.
 */
package physics.core {
import flash.events.MouseEvent;

import mx.controls.Button;
import mx.core.UIComponent;

public class PlayBack extends UIComponent {
    private var _virtualPhysicsLabWork:VirtualPhysicsLabWork;
    private var playButton:Button;
    private var pauseButton:Button;
    private var resetButton:Button;

    public function PlayBack(vpl:VirtualPhysicsLabWork) {
        _virtualPhysicsLabWork = vpl;

        playButton = new Button();
        playButton.x = 0;
        playButton.y = 0;
        playButton.width = 120;
        playButton.height = 23;
        playButton.label = "Запуск";
        playButton.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void{
            _virtualPhysicsLabWork.startLab(); });
        addChild(playButton);

        pauseButton = new Button();
        pauseButton.x = 130;
        pauseButton.y = 0;
        pauseButton.width = 120;
        pauseButton.height = 23;
        pauseButton.label = "Пауза";
        pauseButton.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void{
            _virtualPhysicsLabWork.pauseLab(); });
        addChild(pauseButton);

        resetButton = new Button();
        resetButton.x = 260;
        resetButton.y = 0;
        resetButton.width = 120;
        resetButton.height = 23;
        resetButton.label = "Сброс";
        resetButton.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
            _virtualPhysicsLabWork.resetLab(); });
        addChild(resetButton);
    }

    public function get virtualPhysicsLabWork():VirtualPhysicsLabWork {
        return _virtualPhysicsLabWork;
    }

    public function set virtualPhysicsLabWork(value:VirtualPhysicsLabWork):void {
        _virtualPhysicsLabWork = value;
    }
}
}
